Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(install): Fix Junction creation during installation inside containers #4837

Merged
merged 1 commit into from
Mar 23, 2022

Conversation

kingster
Copy link
Contributor

@kingster kingster commented Mar 22, 2022

Description

Fixes installation of scoop in Dockerfile due to docker/for-win#12240

Motivation and Context

Fixes #4792

How Has This Been Tested?

Tested in windows docker & windows vm

Checklist:

  • I have read the Contributing Guide.
  • I have updated the documentation accordingly.
  • I have updated the tests accordingly.

@kingster kingster changed the title Handle link creation while installing in containers Fix link creation while installing in containers Mar 22, 2022
@kingster
Copy link
Contributor Author

kingster commented Mar 22, 2022

@rashil2000 Can you have a look at this?

I couldn't figure out how to test this, please point me to any doc which I can follow to install from the repo directly.

All Test's passed

Tests completed in 34.51s
Tests Passed: 124, Failed: 0, Skipped: 0, Pending: 0, Inconclusive: 0

@kingster kingster changed the base branch from master to develop March 22, 2022 15:15
@kingster kingster marked this pull request as draft March 22, 2022 16:01
@kingster
Copy link
Contributor Author

Verified that installation succeeds in both docker & normal powershell

#Dockerfile
FROM mcr.microsoft.com/dotnet/framework/runtime:3.5-windowsservercore-ltsc2019
SHELL ["powershell","-C"]
COPY '.\install.ps1' 'install.ps1'
RUN .\install.ps1 -RunAsAdmin
RUN scoop install minisign
RUN minisign
CMD ["pwsh"]
 ---> Running in 1a3904f37a62
Initializing...
Downloading...
Extracting...
Creating shim...
Adding ~\scoop\shims to your path.
Scoop was installed successfully!
Type 'scoop help' for instructions.
Removing intermediate container 1a3904f37a62
 ---> 1f0ab729b2ff
Step 5/7 : RUN scoop install minisign
 ---> Running in f1bdc5d7fae4
Installing 'minisign' (0.10) [64bit]
Downloading https://github.com/jedisct1/minisign/releases/download/0.10/minisign-0.10-win64.zip (154.7 KB)...
Checking hash of minisign-0.10-win64.zip ... ok.
Extracting minisign-0.10-win64.zip ... done.
Linking ~\scoop\apps\minisign\current => ~\scoop\apps\minisign\0.10
Creating shim for 'minisign'.
'minisign' (0.10) was installed successfully!
Removing intermediate container f1bdc5d7fae4
 ---> 6d7a3a97fc0b
Step 6/7 : RUN minisign
 ---> Running in 5b09aa68b5cf
Usage:
minisign -G [-p pubkey] [-s seckey]
minisign -S [-l] [-x sigfile] [-s seckey] [-c untrusted_comment] [-t trusted_comment] -m file [file ...]
minisign -V [-H] [-x sigfile] [-p pubkeyfile | -P pubkey] [-o] [-q] -m file
minisign -R -s seckey -p pubkeyfile

-G                generate a new key pair
-H                require input to be prehashed
-S                sign files
-V                verify that a signature is valid for a given file
-l                sign using the legacy format
-m <file>         file to sign/verify
-o                combined with -V, output the file content after verification
-p <pubkeyfile>   public key file (default: ./minisign.pub)
-P <pubkey>       public key, as a base64 string
-s <seckey>       secret key file (default: ~/.minisign/minisign.key)
-x <sigfile>      signature file (default: <file>.minisig)
-c <comment>      add a one-line untrusted comment
-t <comment>      add a one-line trusted comment
-q                quiet mode, suppress output
-Q                pretty quiet mode, only print the trusted comment
-R                recreate a public key file from a secret key file
-f                force. Combined with -G, overwrite a previous key pair
-v                display version number

The command 'powershell -C minisign' returned a non-zero code: 1

@kingster kingster marked this pull request as ready for review March 22, 2022 17:20
lib/install.ps1 Outdated Show resolved Hide resolved
lib/install.ps1 Outdated Show resolved Hide resolved
lib/install.ps1 Outdated Show resolved Hide resolved
@rashil2000
Copy link
Member

Also, please keep the attrib commands in their original locations (instead of inside new function)

@kingster kingster force-pushed the fix-links branch 2 times, most recently from a0793a9 to 889cba6 Compare March 22, 2022 17:47
@kingster
Copy link
Contributor Author

Done. Moved attrib outside the wrapper function.

@rashil2000
Copy link
Member

Hmm, looks good. One minor nit: We should keep the Out-Null part in the calling location itself, as the output might be required if we were to reuse the New-DirectoryJunction function somewhere else.

Also, please update the changelog

@kingster
Copy link
Contributor Author

Done!

rashil2000
rashil2000 previously approved these changes Mar 22, 2022
@kingster
Copy link
Contributor Author

kingster commented Mar 22, 2022

Removed extra line from bottom of file & trailing whitespaces .

[-] files have no lines containing trailing whitespace 157ms
      RuntimeException: The following 1 lines contain trailing whitespace: 
      File: D:\a\Scoop\Scoop\lib\install.ps1, Line: 12[79](https://github.com/ScoopInstaller/Scoop/runs/5648728336?check_suite_focus=true#step:4:79)
      at <ScriptBlock>, D:\a\Scoop\Scoop\test\Import-File-Tests.ps1: line 109|

@kingster kingster force-pushed the fix-links branch 2 times, most recently from dabc831 to 801e4e2 Compare March 23, 2022 04:31
@niheaven niheaven changed the title Fix link creation while installing in containers fix(install): Fix Junction creation during installation inside containers Mar 23, 2022
@niheaven niheaven merged commit d29e336 into ScoopInstaller:develop Mar 23, 2022
@kingster kingster deleted the fix-links branch March 23, 2022 05:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug] scoop in docker shims seem broken
3 participants